1 # Determine the potential (inside and outside) of a charged sphere (radius R) with a constant internal charge density rho0.
3 # phi(r)'' = -rho0/epsilon0 - 2/r * phi(r)'
4 # with rho0 = 0 outside of sphere
5 # using t as variable for r
7 # compound functions used:
9 define openamp (weight*: variable-1, weight*: variable-2) -> output
10 isum (weight*: variable-1, weight*: variable-2) -> output
14 define idivide (numerator, denominator) -> -quotient
15 openamp (numerator, product) -> -quotient
16 multiply (-quotient, denominator) -> product
19 coefficient.1 -> factor0,2 # shall be set to 0.2
20 coefficient.2 (-1) -> -rho0/epsilon0
21 coefficient.3 (-1) -> -phi0
22 coefficinet.4 (-1) -> -R # -radius of sphere
24 # generate a ramp of t
27 # distinguish in sphere or outside
28 compare (t, -R) -> -rho/epsilon0_l
29 LT0: -rho/epsilon0 # in sphere,
30 GT0: GND # outside sphere
33 iintegrate (1*: -rho0/epsilon0_l, 10*: -0.2/r*phi') -> -phi' # need 2/r*phi' thus 10* input
34 iintegrate (-phi') -> phi
38 # doing this division by t first because phi' is low when also t is, thus there is the chance of less overload
39 idivide (phi', t) -> -phi'/t
40 cmultiply (-phi'/t, factor0.2) -> -0.2/r*phi'